<template>
	<view class="attorneyBind">
		<navbar></navbar>
		<textNavbar myprops="律师绑定"></textNavbar>
		<view class="attorneyBind-container">
			<van-cell-group>
			  <van-field
			    clearable
			    label="手机号"
			    placeholder="请输入手机号"
			    use-button-slot
					custom-style="color: #647088"
					type="number"
					:value="formData.phone"
					@change="Changephone"
			  >
			    <van-button slot="button" size="small" custom-style="color: #647088" @click="yzmHadnler">
			      发送验证码
			    </van-button>
			  </van-field>
				<van-cell-group>
				  <van-field
				    :value="formData.verify"
				    placeholder="请输入验证码"
						label="验证码"
						@change="Changeverify"
				  />
				</van-cell-group>
			</van-cell-group>
			<view class="attorneyBind-btn">
				<button @click="toHandler">绑定</button>
			</view>
		</view>
	</view>
</template>

<script>
	import { serverURL } from '../../../services/httpService';
	export default {
		data() {
			return {
				formData: {
					phone: '', // 手机号
					verify: '', // 验证码
				},
			}
		},
		methods: {
			// 手机号逻辑
			Changephone(event) {
				// event.detail 为当前输入的值
				this.formData.phone = event.detail
			},
			// 验证码逻辑
			Changeverify (event) {
				// event.detail 为当前输入的值
				console.log(event.detail);
			},
			// 绑定按钮逻辑
			toHandler () {
				uni.navigateTo({
					url:"/pages/Attorney side/myLawyerTwo/myLawyerTwo"
				})
			},
			// 发送验证码逻辑
			yzmHadnler () {
				let token = uni.getStorageSync('token');
				console.log(token);
				uni.request({
					url: `${serverURL}/api/getCode`,
					method: "POST",
					header: {
						Authorizationpas: `Bearer ${token}`,
					},
					data: {
						phone: this.formData.phone
					},
					success(res) {
						console.log('成功',res.data);
					},
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

	.a1 {
		margin-top: 16rpx;
		font-size: 28rpx;
	}
	
	.form-shou {
		width: 100%;
		display: flex;
		justify-content: space-between;
		margin-top: 20rpx;
	}
	.form-shou > button {
		font-size: 22rpx;
		line-height: 42rpx;
		color: #FFFFFF;
	}
	
	.attorneyBind-btn {
		width: 690rpx;
		height: 88rpx;
		margin: 16rpx 0 0 30rpx;
	}
	
	.attorneyBind-btn > button {
		color: #FFFFFF;
		background: #036FAF;
		border-radius: 62rpx;
	}
</style>
